<template>
	<view class="page-view flex flex-direction">
		<view class="top-wrap">
			<image class="bg" src="/static/newstitle.png" mode="widthFix"></image>
			<cu-custom :isFixed="true" ref="cuCustom" :isBack="true" bgImage="noImage">
				<template slot="backText">
					返回
				</template>
			</cu-custom>
			<view class="title-name"><text>2023年调剂最新消息</text></view>
		</view>
		<view class="flex-sub main">
			<mescroll-uni @init="mescrollInit" @down="downCallback" @up="upCallback" :fixed="false" ref="mescrollRef">
				<view class="list">
					<view class="item" v-for="(item, index) in schoolList" :key="index">
						<view class="name flex align-center">
							<view class="line"></view>
							<text>{{ item.title }}项目调剂信息</text>
						</view>
						<view class="info">
							<rich-text :nodes="item.description" v-if="item.description"></rich-text>
							<text v-else>暂未配置调剂信息</text>
						</view>
					</view>
				</view>
			</mescroll-uni>
		</view>
	</view>
</template>

<script>
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins.js';
export default {
	data() {
		return {
			schoolList: []
		};
	},
	mixins: [MescrollMixin],
	onLoad(options) {
		// this.getSchools();
	},
	methods: {
		upCallback() {
			this.getSchools();
		},
		getSchools() {
			let pageNum = this.mescroll.num;
			let pageSize = this.mescroll.size;
			this.$postajax(this.$api.getNewsList, {
				pageNum,
				pageSize
			})
				.then(da => {
					if (da.code == 200) {
						if (this.mescroll.num == 1) this.schoolList = [];
						if (da && da.data && da.data.records && da.data.records.length > 0) {
							let curPageData = da.data.records;
							this.mescroll.endBySize(curPageData.length, da.total);
							this.schoolList = this.schoolList.concat(curPageData);
						} else {
							this.mescroll.endSuccess(0, false);
						}
					}
				})
				.catch(e => {
					if (this.mescroll.num == 1) this.schoolList = [];
					this.mescroll.endSuccess(0, false);
				});
		}
	}
};
</script>

<style scoped lang="less">
.page-view {
	height: 100vh;
}
.bg {
	display: block;
	width: 100%;
	height: 240upx;
}
.top-wrap {
	position: relative;
	.title-name {
		position: absolute;
		line-height: 130upx;
		bottom: 0;
		text-align: center;
		left: 0;
		right: 0;
		color: #fff;
		font-weight: bold;
		font-size: 46upx;
		text {
			background-image: -webkit-linear-gradient(top, #fff, #f4b573);
			-webkit-background-clip: text;
			color: transparent;
		}
	}
}
.main {
	height: 0;
	overflow: auto;
}
.list {
	margin-top: 10upx;
	.item {
		background: #fff;
		border-radius: 8upx;
		font-size: 20upx;
		color: #717171;
		line-height: 26upx;
		padding: 25upx 15upx 34upx;
		margin-bottom: 8upx;
		.info {
			padding: 20upx 30upx 0;
		}
		.name {
			color: #020202;
			font-size: 33upx;
			line-height: 1.2;
			.line {
				width: 14upx;
				height: 38upx;
				background: #da6554;
				margin-right: 8upx;
			}
		}
	}
}
</style>
